<template>
  <div>
    <div class="container">
        <div style="margin: 20px;">请登录</div>
        <el-form :label-position="labelPosition" label-width="80px" :model="account">
          <el-form-item label="证件号码">
            <el-input v-model="account.certificateNumber"></el-input>
          </el-form-item>
          <el-form-item label="密码">
            <el-input v-model="account.password"></el-input>
          </el-form-item>

        </el-form>
          <el-button type="primary" @click="businessSign">登录</el-button>
      </div>
  </div>
</template>

<script>
import apis from '../../http/apis/apis'
export default {
  data() {
    return {
      labelPosition: 'right',
      account: {
        certificateNumber: '',
        password: '',
      }
    };
  },
  methods: {
    async businessSign() {
      const {data} = await apis.business.businessSign(this.account)
      console.log(data);
      if(data.status) {
        console.log(data.data[0]);
        localStorage.setItem('account', JSON.stringify(data.data[0]))
        console.log(JSON.parse(localStorage.account));
        alert('登录成功')
        this.$router.push('/system/business/operation')
      }else {
        alert('卡号或密码错误')
      }
    }
  }
}
</script>

<style>
  .container {
      width: 100%;
      height: 400px;
      margin: 20px 0;
      background-color: #fff;
      margin-top: 35px;
      padding: 0 200px;
      padding-top: 70px;
      box-sizing: border-box;
      text-align: center;
      border-radius: 10px;
    }
</style>